package com.aspose.cells;

class zyb extends zj {
   private zafy[] c;
   private zxy[] d;
   private zafy e;

   public zyb(zhh var1, zafy[] var2, zxy[] var3, zafy var4) {
      super(var1, "");
      this.c = var2;
      this.d = var3;
      this.e = var4;
   }

   protected void a(char[] var1, int var2, int var3) {
   }

   public zxy[] c() {
      return this.d;
   }

   public zafy[] d() {
      return this.c;
   }

   public zafy e() {
      return this.e;
   }

   public double a(double var1) {
      if (var1 == 0.0D) {
         return 0.0D;
      } else {
         if (this.c.length >= 2) {
            zafy var3 = var1 > 0.0D ? this.c[0] : this.c[1];
            switch(var3.a()) {
            case 2:
            case 4:
            case 5:
               return ((zo)var3).a(var1);
            case 3:
            }
         }

         return var1;
      }
   }

   public zxz a(zxu var1, int var2, Object var3) {
      switch(var2) {
      case 9:
         return this.b(var1, (double)(Integer)var3);
      case 14:
         return this.b(var1, (Double)var3);
      case 16:
         return this.b(var1, (DateTime)var3);
      case 18:
         if (zbtq.a((String)var3)) {
            this.b.a();
            this.b.a(1, (String)com.aspose.cells.b.a.zr.a(var3));
            return this.b;
         }
      case 10:
      case 11:
      case 12:
      case 13:
      case 15:
      case 17:
      default:
         zafy var4 = this.b(var1, var2, var3);
         if (var4 != null) {
            return this.c.length == 3 && this.e != null && var4.a() == 1 ? ((zht)var4).a(var1, var2, var3, true) : var4.a(var1, var2, var3);
         } else {
            return this.f();
         }
      }
   }

   public zafy a(Object var1) {
      return var1 == null ? null : this.b((zxu)null, zamo.a(var1.getClass()), var1);
   }

   public zafy a(zxu var1, double var2) {
      for(int var4 = 0; var4 < this.c.length; ++var4) {
         if (this.d[var4].a(var2)) {
            return this.c[var4];
         }
      }

      return this.e;
   }

   public zafy a(zxu var1, DateTime var2) {
      double var3 = this.a(var2);

      for(int var5 = 0; var5 < this.c.length; ++var5) {
         if (this.d[var5].a(var3)) {
            return this.c[var5];
         }
      }

      return this.e;
   }

   public zafy b(zxu var1, int var2, Object var3) {
      int var4;
      switch(var2) {
      case 3:
      case 18:
         if (this.e != null) {
            return this.e;
         } else {
            for(var4 = 0; var4 < this.c.length; ++var4) {
               if (this.d[var4].a(var2, var3, this.a.b().c())) {
                  return this.c[var4];
               }
            }

            return this.e;
         }
      case 9:
         return this.a(var1, (double)(Integer)var3);
      case 14:
         return this.a(var1, (Double)var3);
      case 16:
         return this.a(var1, (DateTime)var3);
      default:
         for(var4 = 0; var4 < this.c.length; ++var4) {
            if (this.d[var4].a(var2, var3, this.a.b().c())) {
               return this.c[var4];
            }
         }

         return this.e;
      }
   }

   public int b(Object var1) {
      if (var1 == null) {
         return 0;
      } else {
         zafy var2 = this.b((zxu)null, zamo.a(var1.getClass()), var1);
         return var2 == null ? 0 : var2.g();
      }
   }

   private zxz a(zafy var1, zxu var2, int var3, Object var4) {
      return var1.a() == 1 ? ((zht)var1).a(var2, var3, var4, true) : var1.a(var2, var3, var4);
   }

   private zxz b(zxu var1, DateTime var2) {
      double var3 = this.a(var2);
      zafy var5 = this.a(var1, var3);
      if (var5 != null) {
         return var5.a() == 3 ? ((zl)var5).a(var1, var2, var3, true) : this.a(var5, var1, 14, var3);
      } else {
         return this.f();
      }
   }

   private zxz b(zxu var1, double var2) {
      for(int var4 = 0; var4 < this.c.length; ++var4) {
         if (this.d[var4].a(var2)) {
            return this.a(this.c[var4], var1, 14, var2 < 0.0D && this.d[var4].a() != 6 ? -var2 : var2);
         }
      }

      if (this.e != null) {
         return this.a(this.e, var1, 14, var2);
      } else {
         return this.f();
      }
   }

   private zxz f() {
      this.b.a();
      this.b.a(1, (String)"");
      return this.b;
   }

   public int a() {
      return 6;
   }

   public int g() {
      zafy[] var1 = this.c;
      int var2 = var1.length;
      int var3 = 0;

      while(var3 < var2) {
         zafy var4 = var1[var3];
         switch(var4.a()) {
         case 2:
         case 3:
         case 4:
         case 5:
            return var4.g();
         default:
            ++var3;
         }
      }

      if (this.e != null) {
         switch(this.e.a()) {
         case 2:
         case 3:
         case 4:
         case 5:
            return this.e.g();
         }
      }

      return this.c[0].g();
   }
}
